#include<iostream>
using namespace std;
int n;

void move(int n, char a, char b, char c) {
	if (n == 0)
		return;
	move(n - 1, a, c, b);
	cout << n << ' ' << a << ' ' << b << endl;
	move(n - 1, c, b, a);
}

int main() {
	cin >> n;
	move(n, 'A', 'B', 'C');
	return 0;
}

